package com.jeesite.modules.flow.web;

import com.jeesite.common.entity.Page;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.sys.entity.User;
import com.jeesite.modules.sys.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 流程用户Controller
 *
 * @author Xianlu Tech
 * @date 2019-10-02
 */
@Controller
@RequestMapping(value = "${adminPath}/flow/user")
public class ActIdUserController extends BaseController {

    @Autowired
    private UserService userService;

    /**
     * 选择系统用户
     */
    @RequestMapping(value = "selectUser")
    public String selectUser(User sysUser, Model model) {
        model.addAttribute("taskId", sysUser.getExtend().getExtendS1());
        return "modules/flow/user/selectUser";
    }

    @PostMapping("/systemUserList")
    @ResponseBody
    public Page<User> systemUserList(User sysUser, HttpServletRequest request, HttpServletResponse response) {
        sysUser.setPage(new Page<>(request, response));
        Page<User> page = userService.findPage(sysUser);
        return page;
    }

}
